from flask import Flask, render_template, redirect

app = Flask(__name__)
app.config['SERVER_NAME'] = 'oldboy.com:5000'  # 服务器地址

"""
www.baidu.com
aab.baidu.com  # 子域名aab,www,通过配置获取到子域名

1、添加服务器配置
    app.config['SERVER_NAME'] = 'oldboy.com:5000'  # 服务器地址
2、在route中添加subdomain='username'
    def func(username)  # 接收到子域名
"""

@app.route("/dynamic", subdomain="<username>")
def xxxxxxx(username):
    print(username)
    return 'xxxxx'


if __name__ == '__main__':
    app.run()
